package reflect;
/*使用当前类测试反射机制*/

import reflect.annotations.AutoRunClass;
import reflect.annotations.AutoRunMethod;

@AutoRunClass
public class Person {

    private String name = "张三";
    private int age = 22;

    public Person() {
    }

    public Person(  String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void say(String info){
        System.out.println(name+":"+info);
    }

    public void say(String info,int count){
        for (int i = 0; i < count; i++) {
            System.out.println(name+":"+info);
        }
    }
    private void say(){
        System.out.println("0_0");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
    @AutoRunMethod(5)
    public void sayHello(){
        System.out.println(name+"hello");
    }
    @AutoRunMethod(12)
    public void sayHi(){
        System.out.println(name+"hi");
    }
    @AutoRunMethod(10)
    public void sayGoodbye(){
        System.out.println(name+"bye");
    }
    @AutoRunMethod( 23)
    public void watchTV(){
        System.out.println(name+"看电视");
    }
    @AutoRunMethod(24)
    public void playGame(){
        System.out.println(name+"玩游戏");
    }
}
